import { NetWorkConfig } from './network.config';
// import axios from 'axios';
const axios = require('axios');
// 搜索参数
export class SydwListSearchArgs {

  constructor() {
    this.offset = 0;
    this.num = 10;
  }

}

export class SydwGasListSearchArgs {

  constructor() {
    this.offset = 0;
    this.num = 10;
    this.SydwId = 0;
  }
}
export class MakeComListSearchArgs {
  constructor() {
    this.offset = 0;
    this.num = 10;
  }
}

export class MakeComDetailSearchArgs {
  constructor() {
    this.MakeCom = '';
  }
}
export class MakeComSydwListSearchArgs {
  constructor() {
    this.MakeCom = '';
    this.offset = 0;
    this.num = 10;
  }
}
export class MakeComSydwGasListSearchArgs {
  constructor() {
    this.SydwId = 0;
    this.MakeCom='';
    this.offset = 0;
    this.num = 10;
  }
}

export class CheckUnitListSearchArgs {
  constructor() {
    this.offset = 0;
    this.num = 10;
  }
}
export class CheckUnitDetailSearchArgs {
  constructor() {
    this.offset = 0;
    this.num = 10;
    this.CheckUnit = '';
  }
}
export class CheckUnitSydwListSearchArgs {
  constructor() {
    this.offset = 0;
    this.num = 10;
    this.CheckUnit = '';
  }
}

export class JjUnitListSearchArgs {
  constructor() {
    this.offset = -2; // 前两个是国家级监督检查部门和山东省监督检查部门
    this.num = 10;
  }
}

export class JjUnitDetailSearchArgs {
  constructor() {
    // 根据区域可以确定监管部门
    this.Area = '';
  }
}
export class JjUnitSydwListSearchArgs {
  constructor() {
    this.Area = '';
    this.offset = 0;
    this.num = 10;
  }
}
export class JjUnitGasDetailSearchArgs {
  constructor() {
    this.Area = '';
  }
}
export class JjUnitGasListSearchArgs {
  constructor() {
    this.Area = '';
    this.offset = 0;
    this.num = 10;
  }
}
export class JjUnitCheckUnitListSearchArgs {
  constructor() {
    this.Area = '';
    this.offset = 0;
    this.num = 10;
  }
}

const BASE_URL = NetWorkConfig.BackendUrl + ':' + NetWorkConfig.BackendPort + '/data-service';

export async function serachSydwList(
  searchArgs = new SydwListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/sydw-list',
      params: {
        ...searchArgs
      },
      withCredentials: false
    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
export async function searchSydwDetail(
  SydwId
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/sydw-detail',
      params: {
        SydwId
      },
      withCredentials: false
    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
export async function searchSydwName(
  SydwId
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/sydw-name',
      params: {
        SydwId
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}

export async function searchSydwGasList(
  searchArgs = new SydwGasListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/sydw-gas-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
export async function searchMakeComList(
  searchArgs = new MakeComListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/makecom-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
export async function searchMakeComDetailData(
  searchArgs = new MakeComDetailSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/makecom-detail',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
export async function searchMakeComSydwList(
  searchArgs = new MakeComSydwListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/makecom-sydw-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}

export async function searchMakeComSydwGasList(
  searchArgs = new MakeComSydwGasListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/makecom-sydw-gas-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
export async function searchCheckUnitList(
  searchArgs = new CheckUnitListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/checkunit-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
export async function searchCheckUnitDetailData(
  searchArgs = new CheckUnitDetailSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/checkunit-detail',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
export async function searchCheckUnitSydwList(
  searchArgs = new CheckUnitSydwListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/checkunit-sydw-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
// 获取监督检查部门列表
export async function searchJjUnitList(
  searchArgs = new JjUnitListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/jjunit-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }

}
// 获取监督检查部门相关数据统计
export async function searchJjUnitDetail(
  searchArgs = new JjUnitDetailSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/jjunit-detail',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
// 获取监督检查部门的使用单位列表
export async function searchJjUnitSydwList(
  searchArgs = new JjUnitSydwListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/jjunit-sydw-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
// 获取监督检查部门辖内气瓶列表
export async function searchJjUnitGasList(
  searchArgs = new JjUnitGasListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/jjunit-gas-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
// 获取监督检查部门辖内气瓶相关统计数据
export async function searchJjUnitGasDetail(
  searchArgs = new JjUnitGasDetailSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/jjunit-gas-detail',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}
// 获取监督检查部门辖内气瓶的检验单位列表
export async function searchJjUnitCheckUnitList(
  searchArgs = new JjUnitCheckUnitListSearchArgs()
) {
  try {
    const res = await axios({
      method: 'get',
      url: BASE_URL + '/jjunit-checkunit-list',
      params: {
        ...searchArgs
      },
      withCredentials: false

    })
    return res;
  }
  catch (error) {
    console.error(error)
  }
}